package cn.heygod.graywhale.runtime.context;

import cn.hutool.core.util.IdUtil;

public class Output {


    private Object body;

    private boolean success = true;

    private String msg;

    public Input toInput(){
        Input input = new Input();
        input.setId(IdUtil.getSnowflakeNextIdStr());
        input.setBody(this.getBody());
        return input;
    }

    public void error(Throwable err){
        this.success = false;
        this.msg = err.getMessage();
    }

    public Object getBody() {
        return body;
    }

    public void setBody(Object body) {
        this.body = body;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
